Skip to content

fix: strict type safety with Pydantic validation and comprehensive negative tests#2

Merged
caballeto merged 2 commits into
mainfrom
fix/type-safety-validation-audit
Apr 19, 2026
Merged

fix: strict type safety with Pydantic validation and comprehensive negative tests#2
caballeto merged 2 commits into
mainfrom
fix/type-safety-validation-audit

Conversation

@caballeto
Copy link
Copy Markdown
Member

Summary

  • Regenerate all types from corrected OpenAPI spec (nullable/default annotation fixes from API)
  • Add spec preprocessing script (scripts/preprocess_spec.py) that respects default values when setting required fields
  • Add runtime validation layer (src/devhelm/_validation.py) — all inputs validated via Pydantic before API calls, all responses parsed through Pydantic models
  • Update all 12 resource modules to use generated types and runtime validation
  • Add 410 new negative validation tests covering missing fields, wrong types, invalid enums, format/value constraints
  • Add schema correctness tests verifying generated Pydantic models match expected shapes

Test plan

  • mypy src/ — 0 issues (22 source files)
  • pytest tests/ — 542 tests passed
  • Surface tests (monorepo) — 199 passed, 0 failed

Made with Cursor

…nsive negative tests

- Regenerate types from corrected OpenAPI spec (nullable/default fixes)
- Add preprocessing script (scripts/preprocess_spec.py) respecting default values
- Add runtime validation layer (src/devhelm/_validation.py)
- Validate all API inputs via Pydantic before sending requests
- Parse all API responses through Pydantic models
- Add 410 negative validation tests (tests/test_negative_validation.py)
- Add schema correctness tests (tests/test_schemas.py)
- Update all 12 resource modules to use generated types and validation

Made-with: Cursor
@caballeto caballeto merged commit 4d1f0c3 into main Apr 19, 2026
4 checks passed
@caballeto caballeto deleted the fix/type-safety-validation-audit branch April 19, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant